<%@ page contentType="text/html; charset=big5" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<title>UseCase System</title>
</head>


<%
    PreparedStatement pstmt = null;
	
	
	Class.forName("com.mysql.jdbc.Driver");
    Connection  conn = DriverManager.getConnection("jdbc:mysql://localhost/usecasesystem","root", "12345");
	

	String caseid = request.getParameter("caseid");
  	String casetype = request.getParameter("casetype");
  	String casename = request.getParameter("casename");
  	String actor = request.getParameter("actor");
  	String desc = request.getParameter("desc");
  	String precond = request.getParameter("precond");
  	String trig = request.getParameter("trig");
  	String aa = request.getParameter("aa");
  	String sr = request.getParameter("sr");
  	String ac = request.getParameter("ac");
 	String conclu = request.getParameter("conclu");
  	String postcond = request.getParameter("postcond");
  	String brs = request.getParameter("brs");
  	String app = request.getParameter("app");
	
    
    try {
     
	  
	  String upd =
                "UPDATE usecase SET Use_case_Name = '"+casename+"',`Actor` = '"+actor+"',`Description` = '"+desc+"',`Precondition` = '"+precond+"',`Trig` = '"+trig+"',Actor_Action = '"+aa+"',System_Response = '"+sr+"',Alternate_Courses = '"+ac+"', `Conclusion` = '"+conclu+"',`Postcond` = '"+postcond+"',Business_Rules = '"+brs+"',`Appendix` = '"+app+"' WHERE account_number = '" + session.getAttribute("userid") + "' and Use_case_ID ='" + session.getAttribute("usecaseid") + "' and Case_Type  ='" + session.getAttribute("usecasetype") + "'";
      

	   pstmt = conn.prepareStatement(upd);
	   pstmt.executeUpdate(); %>
	   
	   update success !!

    <%
    }
    catch(SQLException e) { %>
 
      Error !!
	<%
    }
    finally {
        try {
            pstmt.close();
            conn.close();
        }
        catch(SQLException e) {

        }
    }
%>

<% response.setHeader("Refresh", "1; URL=query_show.jsp"); %>


<body>


</body>
</html>
